import type {BasicColumn, FormSchema} from '@/components/Table'
import {useRender} from '@/components/Table'

export const columns: BasicColumn[] = [
  {
    title: '编号',
    dataIndex: 'id',
    width: 100
  },
  {
    title: '业务id',
    dataIndex: 'bizId',
    width: 180
  },
  {
    title: '业务名称',
    dataIndex: 'name',
    width: 160
  },
  {
    title: '业务模板',
    dataIndex: 'template',
    width: 160
  },
  {
    title: '业务配置',
    dataIndex: 'configData',
    width: 160
  },
  {
    title: '业务配置Schema',
    dataIndex: 'appConfigSchema',
    width: 160
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
    customRender: ({ text }) => {
      return useRender.renderDate(text)
    }
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    label: '业务id',
    field: 'bizId',
    component: 'Input',
    colProps: { span: 8 }
  },
  {
    label: '业务名称',
    field: 'name',
    component: 'Input',
    colProps: { span: 8 }
  },
  // {
  //   label: '业务配置',
  //   field: 'configData',
  //   component: 'Input',
  //   colProps: { span: 8 }
  // },
  // {
  //   label: '业务配置Schema',
  //   field: 'appConfigSchema',
  //   component: 'Input',
  //   colProps: { span: 8 }
  // },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'RangePicker',
    colProps: { span: 8 }
  },
]

export const createFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input'
  },
  {
    label: '业务id',
    field: 'bizId',
    show: false,
    required: false,
    component: 'Input'
  },
  {
    label: '业务名称',
    field: 'name',
    required: true,
    component: 'Input'
  },
  {
    label: '业务模板',
    field: 'template',
    component: 'Input',
  },
  {
    label: '业务配置',
    field: 'configData',
    component: 'InputTextArea'
  },
  {
    label: '业务配置Schema',
    field: 'appConfigSchema',
    component: 'InputTextArea'
  },
]

export const updateFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input'
  },
  {
    label: '业务id',
    field: 'bizId',
    required: true,
    dynamicDisabled: true,
    component: 'Input'
  },
  {
    label: '业务名称',
    field: 'name',
    required: true,
    component: 'Input'
  },
  {
    label: '业务模板',
    field: 'template',
    component: 'Input',
  },
  {
    label: '业务配置',
    field: 'configData',
    component: 'InputTextArea'
  },
  {
    label: '业务配置Schema',
    field: 'appConfigSchema',
    component: 'InputTextArea'
  },
]
